#include<bits/stdc++.h>
using namespace std;
const int N=3e2+5;
long long n,t,x,mod,dp[N][N][N],sum[N][N],ans;
int main()
{
	freopen("moon.in","r",stdin);
	freopen("moon.out","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin>>t>>mod;
	sum[0][0]=1;
	for(int i=1;i<=N-5;++i)
	{
		for(int j=1;j<=N-5;++j)
			for(int z=1;z<=j;++z)
				dp[i][j][z]=sum[i-1][j-z];
		for(int j=0;j<=N-5;++j)
		{
			for(int z=1;z<=j;++z)
				sum[i][j]=(sum[i][j]+dp[i][j][z])%mod;
		}
	}
	while(t--)
	{
		cin>>x;
		ans=0;
		for(int i=1;i*i<=x;++i)
			ans+=sum[i][x-i*i],cout<<ans<<" ";
		cout<<ans<<'\n';
	}
	return 0;
}
